home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / os2tools / bnklysrc / sb_write.c < prev    next >
C/C++ Source or Header  |  1989-01-01  |  6KB  |  148 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software <no-Inc>                   */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          No-Cost<no-tm> Software.                       */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello  */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*              Box Drawing subroutines for BinkleyTerm 2.10                */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.210.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU SHOULD  IMMEDIATELY CONTACT THE AUTHORS    */
  24. /*    AT THE  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO    */
  25. /*    USE   THIS  FILE  WITHOUT  HAVING   ACCEPTED  THE  TERMS  OF   THE    */
  26. /*    BINKLEYTERM  LICENSING AGREEMENT,  OR SUCH OTHER  AGREEMENT AS YOU    */
  27. /*    ARE ABLE TO REACH WITH THE AUTHORS.                                   */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /*    The Authors can be reached at the following addresses:                */
  31. /*                                                                          */
  32. /*    Robert C. Hartman                      Vincent E. Perriello           */
  33. /*    Spark Software                         VEP Software                   */
  34. /*    427-3 Amherst Street                   111 Carroll Street             */
  35. /*    CS2032, Suite 232                      Naugatuck, CT 06770            */
  36. /*    Nashua, NH 03061                                                      */
  37. /*                                                                          */
  38. /*    FidoNet 1:132/101                      FidoNet 1:141/491              */
  39. /*    Data    (603) 888-8179                 Data    (203) 729-7569         */
  40. /*                                                                          */
  41. /*    Please feel free to contact us at any time to share your comments     */
  42. /*    about our software and/or licensing policies.                         */
  43. /*                                                                          */
  44. /*                                                                          */
  45. /*   This module is derived from code developed by Augie Hansen in his      */
  46. /*   book "Proficient C" published by Microsoft Press.  Mr. Hansen was      */
  47. /*   kind enough to give us verbal permission to use his routines, and      */
  48. /*   Bob, Vince and Alan (and all our full screen users) are grateful.      */
  49. /*   If you decide to use this code in some package you are doing, give     */
  50. /*   some thought to going out and buying the book. He deserves that.       */
  51. /*                                                                          */
  52. /*--------------------------------------------------------------------------*/
  53.  
  54.  
  55. #include "sbuf.h"
  56. #include "com.h"
  57. #include "xfer.h"
  58. #include "zmodem.h"
  59. #include "keybd.h"
  60. #include "sched.h"
  61. #include "externs.h"
  62. #include "prototyp.h"
  63.  
  64.  
  65. extern BUFFER Sbuf;
  66. extern CELLP Scrnbuf;
  67.  
  68. int sb_wa (win, attr, n)
  69. REGIONP win;
  70. unsigned char attr;
  71. int n;
  72. {
  73.    int i;
  74.    int row;
  75.    int col;
  76.  
  77.    i = n;
  78.    row = win->r0 + win->row;
  79.    col = win->c0 + win->col;
  80.    while (i--)
  81.       (Scrnbuf + row * SB_COLS + col + i)->b.attr = attr;
  82.  
  83.    /* marked the changed region */
  84.    if (col < Sbuf.lcol[row])
  85.       Sbuf.lcol[row] = col;
  86.    if (col + n > Sbuf.rcol[row])
  87.       Sbuf.rcol[row] = col + n;
  88.  
  89.    Sbuf.flags |= SB_DELTA;
  90.  
  91.    return ((i == 0) ? SB_OK : SB_ERR);
  92. }
  93.  
  94. int sb_wc (win, ch, n)
  95. REGIONP win;
  96. unsigned char ch;
  97. int n;
  98. {
  99.    int i;
  100.    int row;
  101.    int col;
  102.  
  103.    i = n;
  104.    row = win->r0 + win->row;
  105.    col = win->c0 + win->col;
  106.    while (i--)
  107.       (Scrnbuf + row * SB_COLS + col + i)->b.ch = ch;
  108.  
  109.    /* marked the changed region */
  110.    if (col < Sbuf.lcol[row])
  111.       Sbuf.lcol[row] = col;
  112.    if (col + n > Sbuf.rcol[row])
  113.       Sbuf.rcol[row] = col + n;
  114.  
  115.    Sbuf.flags |= SB_DELTA;
  116.  
  117.    return ((i == 0) ? SB_OK : SB_ERR);
  118. }
  119.  
  120. int sb_wca (win, ch, attr, n)
  121. REGIONP win;
  122. unsigned char ch;
  123. unsigned char attr;
  124. int n;
  125. {
  126.    int i;
  127.    int row;
  128.    int col;
  129.    unsigned int ca;
  130.  
  131.    i = n;
  132.    ca = (attr << 8) | ch;
  133.    row = win->r0 + win->row;
  134.    col = win->c0 + win->col;
  135.    while (i--)
  136.       (Scrnbuf + row * SB_COLS + col + i)->cap = ca;
  137.  
  138.    /* marked the changed region */
  139.    if (col < Sbuf.lcol[row])
  140.       Sbuf.lcol[row] = col;
  141.    if (col + n > Sbuf.rcol[row])
  142.       Sbuf.rcol[row] = col + n;
  143.  
  144.    Sbuf.flags |= SB_DELTA;
  145.  
  146.    return ((i == 0) ? SB_OK : SB_ERR);
  147. }
  148.